﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.lmpop.createIndex.search.*" %>
<%@page import="com.lmpop.frame.util.PageUtil" %>
<%@page import="com.lmpop.trade.ts_area.*" %>
<%@page import="java.net.URLDecoder"%>
<%@page import="java.util.regex.Pattern"%>
<%@page import="java.util.regex.Matcher"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>店铺信息</title>

<link href="/templets/html/business/css/style.css" rel="stylesheet" type="text/css" />
<link href="/templets/html/business/css/info.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="/templets/html/business/css/layout.css" />
<link rel="stylesheet" type="text/css" href="/templets/html/business/css/company.css" />
<script type="text/javascript" src="/templets/html/business/js/8diansp.js"></script>
</head>
<body>

<%
	String req_url=request.getHeader("Referer");
	if(req_url==null)req_url="";
	if(req_url.indexOf("jinseyaoshi.com")!=-1){%>
		<link href="/templets/html/business/css/style.css" rel="stylesheet" type="text/css" />
		<link href="/templets/html/business/css/info.css" rel="stylesheet" type="text/css">
		<script> 
		  document.write("<s" + "cript type='text/javascript' src='/templets/html/business/top.jsp?" + Math.random() + "'></scr" + "ipt>");
		</script>
	<%}else{%>
		<script> 
	  document.write("<s" + "cript type='text/javascript' src='/templets/html/business/top.jsp?" + Math.random() + "'></scr" + "ipt>");
	</script>
	<%}%>
<%!
	public String getPartLength(String key,int num){if(key.equals("")) return "";
		if(key.length()>num) key = key.substring(0,num)+"...";
		return key;
	}

	public String getDateStr(String in_date,String type){
		if(in_date.equals("")) return "";
		if(in_date.length()>=8){
			String yeard = in_date.substring(0,4);
			String monthd = in_date.substring(4,6);
			String dayd = in_date.substring(6,8);
			if(type.equals("")){
				in_date = yeard+"-"+monthd+"-"+dayd;
			}else{
				in_date = monthd+"-"+dayd;
			}
		}
		return in_date;
	}
	public String clearHtml(String str){
		// <[^> ]+> | </[^> ]+> 为匹配html的正则式
		Pattern p = Pattern.compile( "<(.[^>]*)>");
		Matcher m = p.matcher(str);
		// 返回去除html 后的字符串
		return m.replaceAll( " ");
	} 
%>
<div id="contaner">

<%	
	String cust_id="";
	
	request.setCharacterEncoding("UTF-8");

	if(request.getParameter("cust_id")!=null && !request.getParameter("cust_id").equals("")){
		cust_id = request.getParameter("cust_id");

	}

	CompanyIndexFiles companyInfo = new CompanyIndexFiles();
	AreaIndexFiles areaBean = new AreaIndexFiles();

	Map contentMap = companyInfo.getCustNameById(cust_id);

	String noimg_path="/program/images/cpwu.gif";
	String companyurl = "";
	String company_path = "data/company/";
			
				if(null != contentMap && contentMap.size() > 0){
						//out.print(contentMap);
						String _cust_name="",phone="",email="",business_addr="",_main_product="",_in_date="",file_path="",_company_desc="",user_class="",
							_area_attr="",_company_type="",main_product="",company_typeparam="";
						if(contentMap.get("cust_name")!=null) _cust_name = contentMap.get("cust_name").toString();
					    if(contentMap.get("user_class")!=null) user_class = contentMap.get("user_class").toString();
					    if(contentMap.get("main_product")!=null) main_product=contentMap.get("main_product").toString();
						if(contentMap.get("phone")!=null) phone=contentMap.get("phone").toString();
						if(contentMap.get("email")!=null) email=contentMap.get("email").toString();
						if(contentMap.get("business_addr")!=null) business_addr=contentMap.get("business_addr").toString();
					    if(contentMap.get("company_typeparam")!=null) company_typeparam=contentMap.get("company_typeparam").toString();
					    if(contentMap.get("area_attr")!=null) _area_attr=contentMap.get("area_attr").toString();
					    String areaoutput="";
						if(!_area_attr.equals(""))
						{
						   String areaArr[] = _area_attr.split("\\|");
						   for( int k = 0; k < areaArr.length; k++)
						   {
							  if( k == areaArr.length-1)
							  {
								   areaoutput +=  areaBean.getAreaNameById(areaArr[k]);	 		
							  }
							  else
							  {
								   areaoutput +=  areaBean.getAreaNameById(areaArr[k]);
							  }		   		
						   }
						}
						areaoutput +=business_addr;
						if(contentMap.get("company_desc")!=null) _company_desc=contentMap.get("company_desc").toString();
						_company_desc=clearHtml(_company_desc);
						
						if(contentMap.get("in_date")!=null) _in_date = contentMap.get("in_date").toString();
						_in_date = getDateStr(_in_date,"");
						
						if(contentMap.get("file_path")!=null) file_path = contentMap.get("file_path").toString();
						if(file_path.equals("")) file_path= "/program/images/cpwu.gif";

				            	String class_img="/templets/html/business/images/putong.jpg";
				            	if(user_class.equals("1"))
				            		class_img="/templets/html/business/images/gaoji.jpg";
				            	else if(user_class.equals("2"))
				            		class_img="/templets/html/business/images/VIP.jpg";
				             %>

  <div class="company">
    <h1><%=_cust_name %></h1>
    <div class="boxlist">
      <h3>公司信息</h3>
      <div class="userinfo">
        <div class="portrait">
			<img src="<%=file_path%>" width="80" height="80">
			<a href="#">公司logo</a>
		</div>
        <dl>
          <dt><span class="fr"></span>您好，<span id="endUserName"><%=_cust_name %></span></dt>
          <dd>
			<div class="fl180 noOrder" id="waitpayhref">
				地址:<span id="waitpay"><%=areaoutput %></span>
			</div>
		  </dd>
          <dd><span class="fl180">电话：<span id="waitpay"><%=phone%></span></dd>
		  <dd><span class="fl180">联系邮箱：<span id="waitpay"><%=email%></span></dd>

            </div>
          </dd>
        </dl>
      </div>
    </div>
    <div class="boxlist">
      <h3>公司介绍</h3>
      <div class="userinfo">
        <p> <%=_company_desc %></p>
      </div>
    </div>
  </div>

						<%}else{%>
							 <ul class="ccjy_list sj_list">
								<li>
								<dl class="ccjy_dl">
								<center>没有查到您需要的信息！</center>
								<div class="clear"></div>
								</dl>
							   </li>
							  </ul>	
						<%} %>
	</div>
  <jsp:include page="/templets/html/business/small_footer.jsp"/>
</body>
</html>

